<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>模板</h2>
      <p v-once>{{ count }}</p>
      <p>{{ count }}</p>
      <div>{{ content }}</div>
      <!-- 将html字符串解析成标签进行渲染 -->
      <div v-html="content"></div>
      <!-- v-text和双大括号一样，是变成普通字符串进行渲染 -->
      <div v-text="content"></div>

      <input type="text" v-bind:disabled="disabled" />

      <!-- 动态参数 -->
      <button v-on:click="attr = 'src'">btn</button>
      <div v-bind:[str]="msg">这是一个div</div>
      <img v-bind:[attr]="url" alt="" />
    </div>

    <script src="../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          count: 1,
          content: "<h1>这是标题</h1>",
          disabled: false,
          msg: "123",
          str: "title",
          attr: "data-src",
          url: "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
        },
        mounted() {
          setInterval(() => {
            this.count++;
          }, 1000);
        },
      });
    </script>
  </body>
</html>
